/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.sistemas.postgrado.samupg.repository.dao.implHib;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import pe.edu.sistemas.postgrado.samupg.repository.dao.CorreoDAO;
import pe.edu.sistemas.postgrado.samupg.domain.model.Correo;

/**
 *
 * @author Almendra
 */
@Repository("correoDAO")
public class CorreoDAOImpl implements CorreoDAO{

    private SessionFactory sessionFactory;

    @Autowired
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }
    
    @Override
    public String create(Correo correo) {
        String result = null;

        try {
            sessionFactory.getCurrentSession().save(correo);
        } catch (Exception e) {
            result = e.getMessage();
        }

        return result;
    }
    
}
